﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Linq;
using MySQLStudio.Common.Data;

namespace MySQLStudio.ComponentModel
{
    public class CollationTypeConverter : StringConverter
    {
        public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
        {
            //true means show a combobox
            return true;
        }

        public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
        {
            //true will limit to list. false will show the list, but allow free-form entry
            return true;
        }

        public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            return new StandardValuesCollection(Collations.ServerCollations);
        }

        public override bool IsValid(ITypeDescriptorContext context, object value)
        {
            return Collations.ServerCollations.Contains(value.ToString());
        }
    }
}
